﻿using UnityEngine;
using System.Collections;

public class NektarPickup : MonoBehaviour {
	
	private int _award;
	
	// Use this for initialization
	void Start()
	{
		_award = Random.Range(9, 31);
	}
	
	// Update is called once per frame
	void Update () {
	
	}
	
	void OnTriggerEnter(Collider col)
	{
		if(col.tag == "player")
		{
			col.GetComponent<Controller>().ModifyAmmo(_award);
			Destroy(gameObject);
		}
	}
	
	private void Spawn()
	{
		float duration = 5.0f;
		float timer = 0.0f;
		Vector3 orgScale = transform.localScale;
		
		while(timer < duration)
		{
			transform.localScale = Vector3.Lerp(orgScale, Vector3.zero, (1.0f/duration) * timer);
			timer += Time.deltaTime;
		}
		
		Destroy(gameObject);
	}
}
